package ph.com.gs3.formalistics.model.tables;

public class DocumentsTable extends FLDataTable {

	public static final String TAG = DocumentsTable.class.getSimpleName();

	// table name
	public static final String NAME = "Documents";

	// table columns
	public static final String COL_ID = "_id";
	public static final String COL_WEB_ID = "web_id";
	public static final String COL_SERVER = "server";
	public static final String COL_FORM_WEB_ID = "form_web_id";
	public static final String COL_TRACKING_NUMBER = "tracking_number";
	public static final String COL_STATUS = "status";
	public static final String COL_PROCESSOR = "processor_id";
	public static final String COL_REQUESTOR = "requestor_id";
	public static final String COL_ACTIONS_JSON = "actions_json";
	public static final String COL_WORKFLOW_ID = "workflow_id";
	public static final String COL_NODE_ID = "current_node_id";

	public static final String COL_FIELDS_ENABLED_JSON = "fields_enabled_json";
	public static final String COL_FIELDS_REQUIRED_JSON = "fields_required_json";
	public static final String COL_FIELDS_HIDDEN_JSON = "fields_hidden_json";

	public static final String COL_FIELDS_JSON = "fields_json";

	@Override
	public String[] getTableColumns() {
		return new String[] {

		COL_ID, COL_WEB_ID, COL_TRACKING_NUMBER, COL_STATUS, COL_PROCESSOR, COL_REQUESTOR,
		        COL_ACTIONS_JSON, COL_WORKFLOW_ID, COL_NODE_ID, COL_FIELDS_ENABLED_JSON,
		        COL_FIELDS_REQUIRED_JSON, COL_FIELDS_HIDDEN_JSON, COL_FIELDS_JSON

		};
	}

	@Override
	protected String getCreateTableQuery() {
		// @formatter:off
		return "CREATE TABLE " + NAME + "("
			+ COL_ID 					+ " INTEGER PRIMARY KEY AUTOINCREMENT, "
			+ COL_WEB_ID 				+ " TEXT NOT NULL, "
			+ COL_SERVER 				+ " TEXT NOT NULL, "
			+ COL_FORM_WEB_ID 			+ " TEXT NOT NULL, "
			+ COL_TRACKING_NUMBER 		+ " TEXT NOT NULL, "
			+ COL_STATUS 				+ " TEXT NOT NULL, "
			+ COL_PROCESSOR 			+ " TEXT NOT NULL, "
			+ COL_REQUESTOR 			+ " TEXT NOT NULL, "
			+ COL_ACTIONS_JSON 			+ " TEXT NOT NULL, "
			+ COL_WORKFLOW_ID 			+ " TEXT NOT NULL, "
			+ COL_NODE_ID 				+ " TEXT NOT NULL, "
			+ COL_FIELDS_ENABLED_JSON	+ " TEXT NOT NULL, "
			+ COL_FIELDS_REQUIRED_JSON 	+ " TEXT NOT NULL, "
			+ COL_FIELDS_HIDDEN_JSON 	+ " TEXT NOT NULL, "
			+ COL_FIELDS_JSON 			+ " TEXT NOT NULL"
		+ "); ";
		// @formatter:on
	}

	@Override
	protected String getTableName() {
		return NAME;
	}

}
